﻿using System.Xml.Linq;
using Test1;

namespace Game
{
    public class LordButtonsPanelWidget : CanvasWidget
    {
        public static string[] stringLord = new string[5] { "所谓的创作，是一种孤独又自命不凡的过家家。没有别人来评价的话就没有办法在舞台上散发光彩，观众们为了接受新生的事物，就会和过去的产物进行比较。比起那位古仙温和宽松的产物，我的孩子才是毫无疑问的杰作!毋庸置疑！", "你今天去探索这个世界了吗？还是依旧停滞不前呢？别担心，无论多久，我都会在这里和你一起！", "我说你啊，你的脑子里难道没有齿轮在转动吗？你听到那个声音了吗？", "这个世界很大……确实很大。大到你无法想象，我也无法想象。所以大可以保持热血一直探寻到最后。", "你觉得这个世界怎么样？很美丽，对吧？我也那么认为！毕竟是“那位”的杰作！" };

        public static string[] stringLordCity = new string[5] { "你能来到这个城市……说明你确实已经有些实力了。路途很遥远吧？辛苦你了", "一座令人惋惜的城市……这里曾经有一个才华横溢的博士试图拯救一切，只可惜人力终究无法抵抗神明的毁灭伟力。最后，他也变成了怪物。", "那只傻鸟的话不用太信……不然也不至于都快灭绝了。如果你闲的话，去楼上找她唠嗑吧", "这里是我划出来的安全区，但是范围不大。而且安全区并不能阻止怪物进入，只是怪物无法在安全区生成而已。所以，一切靠你自己。", "如果你的等级小于7.没有开启灵能力量，我建议你立刻调头就走。这里的怪物数量，可不是像外面一样过家家哦。" };

        public bool YHLZ = false;

        public bool BS = false;

        public ComponentTest1 m_componentTest1;

        public ComponentMiner m_componentMiner;

        public ComponentHealth m_componentHealth;

        public ComponentTest1 componentTest1;

        private string entityname1 = "洛德";

        public Random random = new Random();

        public ComponentPlayer m_componentPlayer;

        public SubsystemNPCBehavior m_subsystemNPCBehavior;

        public ComponentMoney m_componentMoney;

        public BevelledButtonWidget m_button6;

        public BevelledButtonWidget m_button7;

        public BevelledButtonWidget m_button8;

        public BevelledButtonWidget m_button9;

        public BevelledButtonWidget m_button10;

        public ComponentTask componentTask;

        public LordButtonsPanelWidget(ComponentMiner componentMiner, SubsystemNPCBehavior subsystemNPCBehavior, ComponentMoney componentMoney, IInventory inventory, ComponentPlayer componentPlayer, ComponentHealth componentHealth)
        {
            m_componentMiner = componentMiner;
            m_subsystemNPCBehavior = subsystemNPCBehavior;
            m_componentMoney = componentMoney;
            m_componentHealth = componentHealth;
            m_componentPlayer = componentPlayer;
            componentTest1 = componentMiner.Entity.FindComponent<ComponentTest1>();
            componentTask = componentPlayer.Entity.FindComponent<ComponentTask>();
            XElement node = ContentManager.Get<XElement>("Talk/Widgets/LordButtonsPanelWidget");
            LoadContents(this, node);
            m_button6 = Children.Find<BevelledButtonWidget>("Button6");
            m_button7 = Children.Find<BevelledButtonWidget>("Button7");
            m_button8 = Children.Find<BevelledButtonWidget>("Button8");
            m_button9 = Children.Find<BevelledButtonWidget>("Button9");
            m_button10 = Children.Find<BevelledButtonWidget>("Button10");
        }

        public override void Update()
        {
            if (m_button6.IsClicked)
            {
                int num = random.Int(0, 4);
                if (componentTest1.Areaname == "失落城市")
                {
                    componentTask.OpenText(stringLordCity[num], entityname1);
                }
            }

            if (m_button7.IsClicked)
            {
                m_componentPlayer.ComponentGui.ModalPanelWidget = new TradingWidget(m_componentMiner.Inventory, m_componentMoney, m_componentMiner.ComponentPlayer, m_componentHealth);
            }

            if (!m_button8.IsClicked)
            {
            }
        }
    }
}